<template>
	<view class="page-view map fullscreen"></view>
</template>

<script>
	import {STORAGE_KEYS, initConfig} from '@/utils/const.js'
	import {formatDate} from '@/utils/utils.js'
	import {getSettings} from '@/api/config.js'
	import {login} from '@/services/miniApi.js'
	
	export default {
		methods: {
			async init(){
				const settings = await getSettings()
				initConfig(settings)
				await login()
			}
		},
		onLoad() {
			this.init().then(()=>{
				// const date = uni.getStorageSync(STORAGE_KEYS.AD)
				// const today = formatDate('yyyy-MM-dd')
				// if(today != date){
				// 	uni.setStorageSync(STORAGE_KEYS.AD, today)
				// 	console.log(uni.getStorageSync(STORAGE_KEYS.AD))
				// 		uni.reLaunch({
				// 			url: '/pages/ad/ad'
				// 		})
				// }else{
				// 	uni.reLaunch({
				// 		url: '/pages/index/index'
				// 	})
				// }
				
				uni.reLaunch({
					url: '/pages/index/index'
				})
			}).catch((err)=>{
				console.log('init', err)
			})
		}
	}
</script>
